'''
# @Title:
# @Time : 2022/3/2 15:19
# @File : mitmMaplocal.py
# @Software: PyCharm

'''
from mitmproxy import http

class MitmMaplocal:

    def request(self,flow:http.HTTPFlow):

        if "quote.json" in flow.request.pretty_url:

            with open('quote.json', encoding='utf-8') as f:

                flow.response = http.Response.make(
                    200,
                    f.read(),
                    {"Content-Type": "application/json"}
                )


addons = [
    MitmMaplocal()
]